package com.objectproject.main.dao;

import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.objectproject.main.dao.iface.MyUserDAO;
import com.objectproject.main.dao.mybatis.mapper.MyUserMapper;
import com.objectproject.main.model.MyUser;

@Repository
public class MyUserDAOImpl implements MyUserDAO {
	
	@Autowired
	SqlSession sqlSession;
	
	@Autowired
	MyLocaleDAOImpl myLocaleDAOImpl;

	@Override
	public MyUser selectMyUserById(long userId) {
		MyUser myUser = sqlSession.getMapper(MyUserMapper.class).selectMyUserById(userId);

		return myUser;
	}

	@Override
	public long insertMyUser(MyUser myUser) {
		sqlSession.getMapper(MyUserMapper.class).insertMyUser(myUser);
		return myUser.getUserId();
	}

	@Override
	public void deleteMyUser(MyUser myUser) {
		sqlSession.getMapper(MyUserMapper.class).deleteMyUser(myUser);
	}

	@Override
	public void deleteMyUserById(long userId) {
		sqlSession.getMapper(MyUserMapper.class).deleteMyUserById(userId);
	}

	@Override
	public void updateMyUser(MyUser myUser) {
		sqlSession.getMapper(MyUserMapper.class).updateMyUser(myUser);
	}

}
